home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_actor_mophia.cog < prev    next >
Text File  |  1999-11-15  |  20KB  |  731 lines

  1. # Jones 3D Cog Script
  2. #
  3. # actor_Mophia.cog
  4. #
  5. # [MDR]
  6. #
  7. #    #####  Notes  #####
  8. #    The following functionality can be accessed with USER msgs sent to this COG
  9. #
  10. #    USER0 - (En\Dis)able a custom mode
  11. #    USER1 - Return current custom mode to caller
  12. #    USER2 - Cancel any VFX, do necessary cleanup.
  13. #    USER3 - Reset Mophia to neutral state.
  14. #    USER4 - Get current Mophia size (3=largest 0=smallest).
  15. #    USER5 - Set Mophia's current alpha as a percent.
  16. #    USER6 - Flash Mophia's eyes.
  17. #
  18. #    n_AICstmMode usuage:
  19. #        0x01 - Boss is angry
  20. #        0x02 - Use claw attack mode
  21. #        0x04 - Use bomb attack mode
  22. #        0x08 - Need to rest
  23. #        0x10 - Start perching
  24. #
  25. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  26. #
  27. # ===================================================================
  28.  
  29. symbols
  30.  
  31. message        startup
  32. message        created
  33. message        removed
  34. message        aievent
  35. message        damaged
  36. message        callback
  37. message        timer
  38. message        user0
  39. message        user1
  40. message        user2
  41. message        user3
  42. message        user4
  43. message        user5
  44. message        user6
  45.  
  46. # ************************** SUBROUTINES ***********************
  47. flex        StartHealAnim                            local
  48. flex        StopHealAnim                            local
  49. flex        BossHurtFX                                local
  50. flex        BossHurtExpl                            local
  51.  
  52. # ************************** TEMPLATES *************************
  53. template    tpl_wpnClaw=+mophiaHit                    local
  54. template    tpl_wpnLaser=+mophiaBeam                local
  55. template    tpl_wpnBomb=+mophiaBomb                    local
  56.  
  57. template    tpl_glow=mophiaGlow                        local
  58. template    tpl_glowSm=mophiaGlowSm                    local
  59. template    tpl_glowXSm=mophiaGlowXSm                local
  60.  
  61. template    tpl_sparks=mophiaSparks                    local
  62. template    tpl_sparksSm=mophiaSparksSm                local
  63. template    tpl_sparksClaw=mardukCharge                local
  64.  
  65. template    tpl_HurtExp=mophiaHurtExp                local
  66. template    tpl_Hurting=mophiaHurting                local
  67.  
  68. template    tpl_sprite0=mophiaBombEmit                local        # forces inclusion
  69. template    tpl_sprite1=mophiaBombSpr                local        # forces inclusion
  70.  
  71. template    tpl_which                                local
  72.  
  73. material    mat_glow=nub_a4sfx_rboss_hit.mat        local
  74.  
  75. model        mdl_large=aet_sm.3do                    local
  76. model        mdl_med=aet_sm_70.3do                    local
  77. model        mdl_sml=aet_sm_45.3do                    local
  78. model        mdl_xsml=aet_sm_25.3do                    local
  79.  
  80. # ************************** MOPHIA SIZE VARS ******************
  81. int            n_size                                    local
  82. vector        vec_fireOffset                            local
  83. vector        vec_lobfireOffset                        local
  84.  
  85. # ************************** SPECIAL FX ************************
  86. int            n_joint00                                local
  87. int            n_joint01                                local
  88. int            n_joint02                                local
  89. int            n_joint03                                local
  90. int            n_joint04                                local
  91. int            n_joint05                                local
  92.  
  93. int            TIMERID_HURTINGFX=1                        local
  94. int            TIMERID_DEATHFX=2                        local
  95.  
  96. # ************************** MISC LOCAL VARS *******************
  97. thing        t_boss                                    local
  98. thing        t_player                                local
  99. thing        t_sender                                local
  100.  
  101. int            n_MophiaSize=0                            local
  102. int            n_fireFlags                                local
  103.  
  104. thing        t_glow=-1                                local
  105. int            n_animHeal=-1                            local
  106. flex        f_pulseHeal                                local
  107. flex        f_minAlpha                                local
  108.  
  109. int            n_AICstmMode                            local
  110. int            CMODE_SUFFERING=1                        local
  111. int            CMODE_NEEDREST=2                        local
  112. int            CMODE_BOMBATTACK=4                        local
  113. int            CMODE_SWOOPATTACK=8                        local
  114. int            CMODE_PERCH=16                            local
  115. int            CMODE_HEAL=32                            local
  116. int            CMODE_NORANGED=64                        local
  117. int            CMODE_SWOOPFLIGHT=128                    local
  118.  
  119. int            n_damageAmount                            local
  120. int            n_damageType                            local
  121. int            n_armedMode                                local
  122.  
  123. int            n_idx                                    local
  124. int            n_param                                    local
  125. int            n_eventType                                local
  126.  
  127. int            b_modeSet                                local
  128. int            n_modeVal                                local
  129.  
  130. sector        sec_atPos                                local
  131. vector        vec_rot                                    local
  132. vector        vec_dir                                    local
  133. vector        vec_pos                                    local
  134. vector        vec_healStartSize                        local
  135. vector        vec_healEndSize                            local
  136. flex        f_val                                    local
  137.  
  138. end
  139.  
  140.  
  141. # ===================================================================
  142. code
  143.  
  144. # ...................................................................
  145. startup:
  146.  
  147.     MaterialAnim(mat_glow, 15, 1);
  148.  
  149.     return;
  150.  
  151.  
  152. # ...................................................................
  153. created:
  154.  
  155.     t_boss        = GetSenderRef();                            # Set constants
  156.     t_player    = GetLocalPlayerThing();
  157.  
  158.     SetActorFlags(t_boss, 0x20000);                            # Set AF_DELAYFIRE
  159. #    SetActorFlags(t_boss, 0x10000000);                        # Set AF_FLYERMOVE
  160. #    AISetSubMode(t_boss, 0xA0000);                            # Set SUBMODE_(SEMICONTINUOUSMOTION|SLOWMODEFADE)
  161.     AISetSubMode(t_boss, 0x80000);                            # Set SUBMODE_SLOWMODEFADE
  162.     SetThingAirDrag(t_boss, 4.5);
  163.  
  164.     n_joint00 = GetNodeByName(t_boss, "smlhand");
  165.     n_joint01 = GetNodeByName(t_boss, "smrhand");
  166.     n_joint02 = GetNodeByName(t_boss, "smtorso");
  167.     n_joint03 = GetNodeByName(t_boss, "smhip");
  168.     n_joint04 = GetNodeByName(t_boss, "smlclaw");
  169.     n_joint05 = GetNodeByName(t_boss, "smrclaw");
  170.  
  171.  
  172.     f_pulseHeal        = 3.0;
  173.     f_minAlpha        = 0.40;
  174.     n_AICstmMode    = 0;
  175.  
  176.     #***  Get current Mophia size and set model dependant values  ***#
  177.     n_size = GetThingModel(t_boss);
  178.  
  179.     if ( n_size == mdl_large )
  180.     {
  181. #        DEBUGPRINT("actor_Mophia:: Created large mophia");
  182.         n_MophiaSize        = 3;
  183.  
  184.         vec_fireOffset        = VectorSet(0.0, 0.056, 0.220);
  185.         vec_lobfireOffset    = VectorSet(0.0, 0.35, 0.08);
  186.         t_glow                = AttachThingToThingMesh(t_boss, tpl_glow, n_joint02);
  187.     }
  188.     else if( n_size == mdl_med )
  189.     {
  190. #        DEBUGPRINT("actor_Mophia:: Created medium mophia");
  191.         n_MophiaSize        = 2;
  192.  
  193.         vec_fireOffset        = VectorSet(0.0, 0.042, 0.155);
  194.         vec_lobfireOffset    = VectorSet(0.0, 0.25, 0.155);
  195.         t_glow                = AttachThingToThingMesh(t_boss, tpl_glow, n_joint02);
  196.     }
  197.     else if( n_size == mdl_sml )
  198.     {
  199. #        DEBUGPRINT("actor_Mophia:: Created small mophia");
  200.         n_MophiaSize        = 1;
  201.  
  202.         vec_fireOffset        = VectorSet(0.0, 0.03, 0.10);
  203.         vec_lobfireOffset    = VectorSet(0.0, 0.18, 0.10);
  204.         t_glow                = AttachThingToThingMesh(t_boss, tpl_glowSm, n_joint02);
  205.     }
  206.     else
  207.     {
  208. #        DEBUGPRINT("actor_Mophia:: Created xsmall mophia");
  209.         n_MophiaSize        = 0;
  210.  
  211.         vec_fireOffset        = VectorSet(0.0, 0.03, 0.05);
  212.         t_glow                = AttachThingToThingMesh(t_boss, tpl_glowXSm, n_joint02);
  213.     }
  214.  
  215.     AIEnableInstinct(t_boss, "lobfire", 0);
  216.     SetThingFireoffset(t_boss, vec_fireOffset);
  217.  
  218.     return;
  219.  
  220.  
  221. # ...................................................................
  222. removed:
  223.  
  224.     # Perform cleanup of VFX
  225.     call USER2;
  226.  
  227.     return;
  228.  
  229.  
  230. # ...................................................................
  231. aievent:
  232.  
  233.     if ( GetSenderRef() != t_boss ) return;
  234.  
  235.     n_eventType    = GetParam(0);
  236.     n_param        = GetParam(2);                                # Value depends on n_eventType
  237.  
  238.     if (n_eventType == 0x10000)                                #---- EVENT_PREFIRE ----
  239.     {
  240.         n_armedMode = AIGetArmedMode(t_boss);
  241.         n_fireFlags = n_param;
  242.  
  243.         if ( BITTEST(n_fireFlags, 0x0002) )                        #-- SITHAIUTIL_FIRE_LOB
  244.         {
  245.             if ( n_armedMode != 1 )
  246.             {
  247.                 SetActorWeapon(t_boss, -1);                        # No lob attack in these armed modes
  248.                 return;
  249.             }
  250.             if ( BITTEST(n_AICstmMode, CMODE_NEEDREST | CMODE_NORANGED) )
  251.             {
  252.                 SetActorWeapon(t_boss, -1);                        # No alt attack in this mode
  253.                 return;
  254.             }
  255.             if ( !BITTEST(n_AICstmMode, CMODE_BOMBATTACK) )
  256.             {
  257.                 SetActorWeapon(t_boss, -1);                        # No alt attack in this mode
  258.                 return;
  259.             }
  260.  
  261.             SetThingFireoffset(t_boss, vec_lobfireOffset);
  262.             SetActorWeapon(t_boss, tpl_wpnBomb);                # Set bomb weapon
  263.         }
  264.         else if ( BITTEST(n_fireFlags, 0x0020) )                #-- SITHAIUTIL_FIRE_ALT
  265.         {
  266.             if ( (n_armedMode == 0) || (n_armedMode == 3) )
  267.             {
  268.                 SetActorWeapon(t_boss, -1);                        # No alt attack in these armed modes
  269.                 return;
  270.             }
  271.             if ( BITTEST(n_AICstmMode, CMODE_NEEDREST | CMODE_SWOOPATTACK | CMODE_NORANGED) )
  272.             {
  273.                 SetActorWeapon(t_boss, -1);                        # No alt attack in these cust modes
  274.                 return;
  275.             }
  276.  
  277.             SetActorWeapon(t_boss, tpl_wpnLaser);
  278.         }
  279.     }
  280.     else if (n_eventType == 0x4000)                            #---- EVENT_FIRE ----
  281.     {
  282.         if ( BITTEST(n_fireFlags, 0x22) )                        # Ranged attack?
  283.         {
  284.             StopThing(t_boss);
  285.             AISetLookPos(t_boss, GetThingPos(t_player));
  286.             PlaySoundClass(t_boss, 125);                        # play 'charge up' sound
  287.         }
  288.     }
  289.     else if (n_eventType == 0x20000)                        #---- EVENT_POSTFIRE ----
  290.     {
  291.         n_fireFlags = 0;
  292.         SetThingFireoffset(t_boss, vec_fireOffset);
  293.         SetActorWeapon(t_boss, tpl_wpnClaw);                    # Reset to primary weapon
  294.     }
  295.  
  296.     return;
  297.  
  298.  
  299. # ...................................................................
  300. callback:
  301.  
  302.     t_sender = GetSenderRef();
  303.     n_param  = GetParam(1);
  304.     if ( t_sender != t_boss )
  305.         return;
  306.  
  307.     if (n_param == 16)                                        #---- Wing sparks
  308.     {
  309.         if ( BITTEST(n_AICstmMode, CMODE_SUFFERING) )            # skip additional sparks when suffering
  310.             return;
  311.  
  312.         if ( n_MophiaSize==3 || n_MophiaSize==2 )
  313.         {
  314.             tpl_which = tpl_sparks;
  315.         }
  316.         else
  317.         {
  318.             tpl_which = tpl_sparksSm;
  319.         }
  320.  
  321.         vec_pos = GetThingJointPos(t_boss, n_joint03);            # sparks from hip
  322.         CreateThingAtPos(tpl_which, FindNewSectorFromThing(t_boss, vec_pos), vec_pos, '0 0 0');
  323.  
  324.         if ( Rand() < 0.30 && n_MophiaSize > 1 )                # sparks from wing tips
  325.         {
  326.             vec_pos = GetThingJointPos(t_boss, n_joint00);
  327.             CreateThingAtPos(tpl_which, FindNewSectorFromThing(t_boss, vec_pos), vec_pos, '0 0 0');
  328.  
  329.             vec_pos = GetThingJointPos(t_boss, n_joint01);
  330.             CreateThingAtPos(tpl_which, FindNewSectorFromThing(t_boss, vec_pos), vec_pos, '0 0 0');
  331.         }
  332.     }
  333.     if (n_param == 21)                                        #---- Wing flap
  334.     {
  335.         PlaySoundClass(t_boss, 46);                                # play 'lwalkaet'
  336.     }
  337.     if (n_param == 22)                                        #---- Right claw sparks
  338.     {
  339.         vec_pos = GetThingJointPos(t_boss, n_joint05);
  340.         CreateThingAtPos(tpl_sparksClaw, FindNewSectorFromThing(t_boss, vec_pos), vec_pos, '0 0 0');
  341.     }
  342.     if (n_param == 23)                                        #---- Left claw sparks
  343.     {
  344.         vec_pos = GetThingJointPos(t_boss, n_joint04);
  345.         CreateThingAtPos(tpl_sparksClaw, FindNewSectorFromThing(t_boss, vec_pos), vec_pos, '0 0 0');
  346.     }
  347.  
  348.     return;
  349.  
  350.  
  351. # ...................................................................
  352. timer:
  353.  
  354.     if ( GetSenderID() == TIMERID_HURTINGFX )
  355.     {
  356.         n_AICstmMode = BITCLEAR(n_AICstmMode, CMODE_SUFFERING);
  357.  
  358.         n_idx = GetParam(0);
  359.         if ( n_idx > 1 )
  360.         {
  361.             n_AICstmMode = BITSET(n_AICstmMode, CMODE_SUFFERING);        # keep on suffering
  362.             call BossHurtFX;
  363.  
  364.             n_idx = n_idx - 1;
  365.             SetTimerEx(0.1, TIMERID_HURTINGFX, n_idx, 0);
  366.         }
  367.     }
  368.  
  369.     if ( GetSenderID() == TIMERID_DEATHFX )
  370.     {
  371.         n_idx = GetParam(0);
  372.         if ( n_idx > 1 )
  373.         {
  374.             n_AICstmMode = BITSET(n_AICstmMode, CMODE_SUFFERING);        # keep on suffering
  375.             call BossHurtExpl;
  376.  
  377.             n_idx = n_idx - 1;
  378.             SetTimerEx(1.5, TIMERID_DEATHFX, n_idx, 0);
  379.         }
  380.     }
  381.  
  382.     return;
  383.  
  384.  
  385. # ...................................................................
  386. damaged:
  387.  
  388.     n_damageAmount    = GetParam(0);
  389.     n_damageType    = GetParam(1);
  390.  
  391.     if ( BITTEST(n_damageType, 0x800) )                                #---- SITH_DAMAGE_ELECTROWHIP?
  392.     {
  393.         #***  Play hurt VFX when in xsml size  ***#
  394.         if ( n_MophiaSize == 0 )
  395.         {
  396.             n_AICstmMode = BITSET(n_AICstmMode, CMODE_SUFFERING);
  397.  
  398.             SetTimerEx(1.0, TIMERID_HURTINGFX, 20, 0);
  399.             call BossHurtExpl;
  400.         }
  401.  
  402.         PlayMode(t_boss, 75, 0);                                    # Play 'hit' anim manually
  403.         PlaySoundClass(t_boss, 92);                                    # Play 'hurt' sound manually
  404.     }
  405.  
  406.     ReturnEx(0);                                                    # Take no damage
  407.  
  408.     return;
  409.  
  410.  
  411. # ...................................................................
  412. # (En\Dis)able a custom mode
  413. # ...................................................................
  414. user0:
  415.  
  416.     b_modeSet    = GetParam(0);
  417.     n_modeVal    = GetParam(1);
  418.  
  419.     if ( b_modeSet > 0 )
  420.     {
  421.         if ( BITTEST(n_AICstmMode, n_modeVal) )                                # Dont re-set values
  422.             return;
  423.  
  424.         n_AICstmMode = BITSET(n_AICstmMode, n_modeVal);
  425.     }
  426.     else
  427.     {
  428.         if ( !BITTEST(n_AICstmMode, n_modeVal) )                            # Dont re-clear values
  429.             return;
  430.  
  431.         n_AICstmMode = BITCLEAR(n_AICstmMode, n_modeVal);
  432.     }
  433.  
  434.     #***  Perform any necessary special handling  ***#
  435.     if ( b_modeSet )
  436.     {
  437.         if ( BITTEST(n_modeVal, CMODE_SUFFERING) )
  438.         {
  439. #            DEBUGPRINT("actor_Mophia:: Setting suffer mode");
  440.         }
  441.         if ( BITTEST(n_modeVal, CMODE_BOMBATTACK) )
  442.         {
  443. #            DEBUGPRINT("actor_Mophia:: Setting bomb attack mode");
  444.             AIEnableInstinct(t_boss, "lobfire", 1);
  445.         }
  446.         if ( BITTEST(n_modeVal, CMODE_SWOOPATTACK) )
  447.         {
  448. #            DEBUGPRINT("actor_Mophia:: Setting swoop attack mode");
  449.         }
  450.         if ( BITTEST(n_modeVal, CMODE_SWOOPFLIGHT) )
  451.         {
  452. #            DEBUGPRINT("actor_Mophia:: Setting swoop flight mode");
  453.             ResetThing(t_boss);
  454.             SetArmedMode(t_boss, 0);                                        # Switch to swoop armed mode (0)
  455.             PlayMode(t_boss, 1, 0);                                            # Play PUPPETSUBMODE_STAND
  456.         }
  457.         if ( BITTEST(n_modeVal, CMODE_NEEDREST) )
  458.         {
  459. #            DEBUGPRINT("actor_Mophia:: Setting rest mode");
  460. #            ThingFadeAnim(t_boss, 1.0, f_minAlpha, 3.0, 0);
  461. #            SetCollideType(t_boss, 0);
  462.         }
  463.         if ( BITTEST(n_modeVal, CMODE_NORANGED) )
  464.         {
  465. #            DEBUGPRINT("actor_Mophia:: Setting no ranged mode");
  466.         }
  467.  
  468.  
  469.         if ( BITTEST(n_modeVal, CMODE_PERCH) )
  470.         {
  471. #            DEBUGPRINT("actor_Mophia:: Setting perch mode");
  472.             ResetThing(t_boss);
  473.             SetArmedMode(t_boss, 3);                                        # Switch to perch armed mode (3)
  474.             PlayMode(t_boss, 70, 1);                                        # Play PUPPETADDIN_WALK2STAND (3)
  475.             PlayMode(t_boss, 1, 0);                                            # Play PUPPETSUBMODE_STAND
  476.  
  477.             SetActorFlags(t_boss, 0x40000);                                    # Set AF_IMMOBILE
  478.         }
  479.         if ( BITTEST(n_modeVal, CMODE_HEAL) )
  480.         {
  481. #            DEBUGPRINT("actor_Mophia:: Setting heal mode");
  482.             call StartHealAnim;
  483.         }
  484.     }
  485.     else if ( !b_modeSet )
  486.     {
  487.         if ( BITTEST(n_modeVal, CMODE_SUFFERING) )
  488.         {
  489. #            DEBUGPRINT("actor_Mophia:: Clearing suffer mode");
  490.         }
  491.         if ( BITTEST(n_modeVal, CMODE_BOMBATTACK) )
  492.         {
  493. #            DEBUGPRINT("actor_Mophia:: Clearing bomb attack mode");
  494.             AIEnableInstinct(t_boss, "lobfire", 0);
  495.         }
  496.         if ( BITTEST(n_modeVal, CMODE_SWOOPATTACK) )
  497.         {
  498. #            DEBUGPRINT("actor_Mophia:: Clearing swoop attack mode");
  499.         }
  500.         if ( BITTEST(n_modeVal, CMODE_SWOOPFLIGHT) )
  501.         {
  502. #            DEBUGPRINT("actor_Mophia:: Clearing swoop flight mode");
  503.             ResetThing(t_boss);
  504.             SetArmedMode(t_boss, 1);                                        # Return to flying armed mode (1)
  505.             PlayMode(t_boss, 1, 0);                                            # Play PUPPETSUBMODE_STAND
  506.         }
  507.         if ( BITTEST(n_modeVal, CMODE_NEEDREST) )
  508.         {
  509. #            DEBUGPRINT("actor_Mophia:: Clearing rest mode");
  510. #            SetCollideType(t_boss, 3);
  511. #            SetThingAlpha(t_boss, 1.0);
  512.         }
  513.         if ( BITTEST(n_modeVal, CMODE_NORANGED) )
  514.         {
  515. #            DEBUGPRINT("actor_Mophia:: Clearing no ranged mode");
  516.         }
  517.  
  518.  
  519.         if ( BITTEST(n_modeVal, CMODE_PERCH) )
  520.         {
  521. #            DEBUGPRINT("actor_Mophia:: Clearing perch mode");
  522.             ClearActorFlags(t_boss, 0x40000);                                # Clear AF_IMMOBILE
  523.  
  524.             PlayMode(t_boss, 69, 1);                                        # Play PUPPETADDIN_STAND2WALK, (3)
  525.             PlayMode(t_boss, 17, 1);                                        # Play PUPPETSUBMODE_JUMPFWD, (3)
  526.  
  527.             ResetThing(t_boss);
  528.             SetArmedMode(t_boss, 1);                                        # Return to flying armed mode (1)
  529.             PlayMode(t_boss, 1, 0);                                            # Play PUPPETSUBMODE_STAND
  530.         }
  531.         if ( BITTEST(n_modeVal, CMODE_HEAL) )
  532.         {
  533. #            DEBUGPRINT("actor_Mophia:: Clearing heal mode");
  534.             call StopHealAnim;
  535.         }
  536.     }
  537.  
  538.     ReturnEx(n_AICstmMode);
  539.  
  540.     return;
  541.  
  542.  
  543. # ...................................................................
  544. # Return current custom mode to caller
  545. # ...................................................................
  546. user1:
  547.  
  548.     ReturnEx(n_AICstmMode);
  549.     return;
  550.  
  551.  
  552. # ...................................................................
  553. # Perform VFX cleanup
  554. # ...................................................................
  555. user2:
  556.  
  557.     if ( t_glow > -1 )
  558.     {
  559. #        DEBUGPRINT("actor_Mophia:: Removing all Mophia VFX");
  560.  
  561.         if ( GetThingType(t_glow) == 13 )                    # Check for SITH_THING_SPRITE
  562.         {
  563.             DestroyThing(t_glow);
  564.             t_glow = -1;
  565.         }
  566.     }
  567.  
  568. #    call StopHealAnim;
  569.  
  570.     return;
  571.  
  572.  
  573. # ...................................................................
  574. # Reset Mophia to neutral state
  575. # ...................................................................
  576. user3:
  577.  
  578. #    DEBUGPRINT("actor_Mophia:: Resetting Mophia");
  579.     if ( BITTEST(n_AICstmMode, CMODE_BOMBATTACK) )
  580.     {
  581.         n_AICstmMode = CMODE_BOMBATTACK;
  582.     }
  583.     else
  584.     {
  585.         n_AICstmMode = 0;
  586.     }
  587.  
  588.     ResetThing(t_boss);
  589.     SetArmedMode(t_boss, 1);                                        # Return to flying armed mode (1)
  590.     PlayMode(t_boss, 1, 0);                                            # Play PUPPETSUBMODE_STAND
  591.  
  592.     SetCollideType(t_boss, 3);
  593.     SetThingAlpha(t_boss, 1.0);
  594.  
  595.     ClearActorFlags(t_boss, 0x40000);                                # Clear AF_IMMOBILE
  596.  
  597.     call StopHealAnim;
  598.  
  599.     return;
  600.  
  601.  
  602. # ...................................................................
  603. # Return current Mophia size
  604. # ...................................................................
  605. user4:
  606.  
  607. #    DEBUGFLEX(n_MophiaSize, "actor_Mophia:: Returning current Mophia size");
  608.     ReturnEx(n_MophiaSize);
  609.  
  610.     return;
  611.  
  612.  
  613. # ...................................................................
  614. # Set Mophia's alpha as a percent (param0) above allowed minimum
  615. # ...................................................................
  616. user5:
  617.  
  618.     f_val = GetParam(0) / 100;
  619.     f_val = ((100 - f_minAlpha) * f_val) + f_minAlpha;
  620.  
  621.     SetThingAlpha(t_boss, f_val);
  622.  
  623. #    DEBUGFLEX(f_val, "actor_Mophia:: Setting Mophia alpha at");
  624.  
  625.     return;
  626.  
  627.  
  628. # ...................................................................
  629. # Various Mophia VFX
  630. # ...................................................................
  631. user6:
  632.  
  633.     n_param = GetParam(0);
  634.  
  635. #    DEBUGFLEX(n_param, "actor_Mophia:: Got USER6, param(0) =");
  636.  
  637.     if ( n_param == 0 )                                                #---- Flash eyes
  638.     {
  639.         t_sender = CreateThing(tpl_wpnLaser, t_boss);
  640.  
  641.         if ( t_sender > -1 )
  642.         {
  643.             SendMessageEx(GetThingClassCog(t_sender), USER0, t_boss, 0, 0, 0);
  644.             DestroyThing(t_sender);
  645.         }
  646.     }
  647.     else if ( n_param == 1 )                                        #---- Hurt cloud
  648.     {
  649.         call BossHurtFX;
  650.     }
  651.     else if ( n_param == 2 )                                        #---- Hurt explosion
  652.     {
  653.         call BossHurtExpl;
  654.     }
  655.     else if ( n_param == 3 )                                        #---- Begin Death VFX
  656.     {
  657.         n_AICstmMode = BITSET(n_AICstmMode, CMODE_SUFFERING);
  658.  
  659.         SetTimerEx(1.0, TIMERID_DEATHFX, 10, 0);
  660.     }
  661.     else if ( n_param == 4 )                                        #---- End Death VFX
  662.     {
  663.         KillTimerEx(TIMERID_HURTINGFX);
  664.         KillTimerEx(TIMERID_DEATHFX);
  665.     }
  666.  
  667.     return;
  668.  
  669.  
  670. # ===================================================================
  671. #    Subroutines
  672. # ===================================================================
  673.  
  674. # ...................................................................
  675. StartHealAnim:
  676.  
  677.     if ( n_animHeal == -1 )
  678.     {
  679. #        DEBUGPRINT("actor_Mophia:: Starting heal pulse");
  680.         n_animHeal = ThingFadeAnim(t_boss, f_minAlpha, 1.0, f_pulseHeal, 1);
  681.     }
  682.  
  683.     return;
  684.  
  685.  
  686. # ...................................................................
  687. StopHealAnim:
  688.  
  689.     if ( n_animHeal > -1 )
  690.     {
  691. #        DEBUGPRINT("actor_Mophia:: Stopping heal pulse");
  692.         StopAnim(n_animHeal);
  693.         n_animHeal = -1;
  694.     }
  695.  
  696.     SetThingAlpha(t_boss, 1.0);
  697.  
  698.     return;
  699.  
  700.  
  701. # ...................................................................
  702. BossHurtFX:
  703.  
  704.     vec_pos        = GetThingJointPos(t_boss, n_joint02);            #---- Emit hurt sparks from torso
  705.     sec_atPos    = FindNewSectorFromThing(t_boss, vec_pos);
  706.     CreateThingAtPos(tpl_Hurting, sec_atPos, vec_pos, '0 0 0');
  707.  
  708.     return;
  709.  
  710.  
  711. # ...................................................................
  712. BossHurtExpl:
  713.  
  714.     vec_pos        = GetThingJointPos(t_boss, n_joint02);            #---- Large sparks from torso
  715.     sec_atPos    = FindNewSectorFromThing(t_boss, vec_pos);
  716.     vec_dir        = GetThingLVecPYR(t_boss);
  717.  
  718.     n_param = VectorZ(vec_dir);
  719.     for (n_idx = 0; n_idx < 6; n_idx = n_idx + 1)
  720.     {
  721.         n_param = n_param + 60;
  722.         vec_dir    = VectorSet(VectorX(vec_dir), VectorY(vec_dir), n_param);
  723.         CreateThingAtPos(tpl_HurtExp, sec_atPos, vec_pos, vec_dir);
  724.     }
  725.  
  726.     return;
  727.  
  728.  
  729. # ===================================================================
  730. end
  731.